* round up some loose endians in mapbar.
* round up another endian, this time in mapsend.
* chase the endians out of naviguide.
also, a potential bug with Qstring length vs. encoded string length.
(void) read_datetime(); // start_time currently unused
(void) read_datetime(); // end_time currently unused
- ushort name[200] = {0};
- gbfread((void*)name, 1, 200, fin);
- // At this point, name is a UCS-16 encoded, zero terminated string.
+ ushort name[101];
+ // read 100 UCS-2 characters that are each stored little endian.
+ // note gbfread wouldn't get this right on big endian machines.
+ for (int idx=0; idx<100; idx++) {
+ name[idx] = gbfgetint16(fin);
+ }
+ name[100] = 0;
+ // At this point, name is a UCS-2 encoded, zero terminated string.
// All our internals use Qt encoding, so convert now.
track->rte_name = QString().fromUtf16(name);
}
}
- gbfwrite(&c, 1, 1, mapsend_file_out);
+ gbfputc(c, mapsend_file_out);
gbfputc(1, mapsend_file_out);
falt = waypointp->altitude;
char z[50];
memset(z, 0, 50);
- i = s.length();
- gbfwrite(&i, 1, 1, f);
+ i = strlen(STRFROMUNICODE(s));
+ gbfputc(i, f);
gbfwrite(STRFROMUNICODE(s), 1, i, f);
gbfwrite(&wp_data->pad1[0], 8, 1, f);
gbfwrite(&wp_data->pad2[0], 2, 1, f);
gbfputint32(wp_data->Alt, f);
- i = d.length();
- gbfwrite(&i, 1, 1, f);
+ i = strlen(STRFROMUNICODE(d));
+ gbfputc(i, f);
gbfwrite(STRFROMUNICODE(d), 1, i, f);
gbfwrite(z, 44, 1, f);
}